package Lib3d.Scenes;


import Lib3d.Vector3d;
import Lib3d.Animation.AnimationFactory;
import Lib3d.Animation.SimpleAnimationImpl;
import Lib3d.PresetModel3d.HairySphere;
import Lib3d.SceneGraph.Group;
import Lib3d.SceneGraph.Node;
import Lib3d.SceneGraph.Impl.AnimatedGroupImpl;
import Lib3d.SceneGraph.Impl.GroupImpl;

import java.awt.Color;
import java.util.Iterator;

import javax.media.opengl.GLAutoDrawable;

/**
 * A implementation of a simple hairy shpere scene (whith one hairy sphere).
 * 
 * @author Wassim Chegham
 * @version 0.1
 * @category Lib3d.Scenes
 * 
 */
public class SceneSimpleHairySphere implements Scene {

    final Group tmpRoot = new GroupImpl();

    public void addChild(final Node child) {
        this.tmpRoot.addChild(child);
    }

    public Iterator<Node> childIterator() {
        return this.tmpRoot.childIterator();
    }

    public Node draw() {
        final HairySphere sphere1 = new HairySphere(new Vector3d(0, 0, 0), 100f, 100,
                Color.YELLOW, Color.BLUE);
        final AnimatedGroupImpl agr1 = new AnimatedGroupImpl();
        final SimpleAnimationImpl anim1 = (SimpleAnimationImpl) AnimationFactory
                .createSimpleAnimation();
        anim1.setDistance(100);
        agr1.addAnimation(anim1);
        agr1.addChild(sphere1);
        this.tmpRoot.addChild(agr1);
        return this.tmpRoot;
    }

    public void draw(final GLAutoDrawable gLDrawable) {
        this.tmpRoot.draw(gLDrawable);
    }

}
